/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Engine;

import Control.GameController;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;

/**
 *
 * @author Gustavo Buzogany Eboli
 */
public class MouseManager extends MouseAdapter implements MouseMotionListener {

    private int mousex, mousey;
    private Engine engine;
    private Renderer renderer;
    private GameController gc;

    /**
     * Construtor
     * @param engine ponteiro para a engine
     * @param gc ponteiro para o GameController
     */
    public MouseManager(Engine engine, GameController gc)
    {
        this.engine = engine;
        this.gc = gc;
    }

    /**
     * Atribui o renderer.
     * @param renderer Ponteiro para o renderer
     */
    public void setRenderer(Renderer renderer)
    {
        this.renderer = renderer;
    }

    @Override
    public void mouseMoved(MouseEvent e) {
        gc.mouseMoved(e.getX(), e.getY());
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        this.gc.setClicked();
        this.renderer.setClicked(e.getX(), e.getY());
    }
}
